package com.usian.article.controller

import com.usian.apis.article.ApArticleControllerApi
import com.usian.article.service.impl.ApArticleServiceImpl
import com.usian.model.article.pojos.ApArticle
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/api/v1/article")
open class ApArticleController : ApArticleControllerApi {
    @Autowired
    lateinit var apArticleService: ApArticleServiceImpl

    @PostMapping("save")
    override fun saveArticle(@RequestBody apArticle: ApArticle): ApArticle =apArticle.apply { apArticleService.save(this) }
}